home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1998 Macromedia, Inc. All rights reserved.
- //-----------------------------------------------------
- //
- // Source Formatting.js
- //
- // This file contains the implementation to fire off the Dreamweaver
- // source formatter.
-
- function canAcceptCommand()
- {
- return (dw.getFocus() == 'document');
- }
-
- // formatSource()
- //
- // This routine kicks off the Dreamweaver source formatter
- // on the entire document by "touching" the HTML child tag
- // outerHTML properties.
- //
- function formatSource()
- {
- var root = dreamweaver.getDocumentDOM("document");
- var children = root.childNodes;
- var nChildren = children.length;
-
- // Go one level below HTML tag -- the outerHTML property
- // on the HTML tag has slightly different update semantics
- // that the rest of the objects in the tree
- //
- for( var i = 0; i < nChildren; i++ )
- {
- var child = children.item(i);
- if ( child.hasChildNodes() )
- {
- var subChildren = child.childNodes;
- var nSubChildren = subChildren.length;
-
- for( var j = 0; j < nSubChildren; j++ )
- subChildren.item(j).outerHTML += "";
- }
- }
-
- return;
- }
-